<%@ page import="service.serviceimpl.ServiceUserImpl" %>
<%@ page import="entity.Userinfo" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <style>
        p{
            color: red;
        }
        #p1,p{
            display: block;
            margin: auto;
            width: 200px;
        }table{
             display: block;
             margin: auto;
             width: 400px;
         }
    </style>
</head>
<body>
<table border="4">
    <tr><td>人员列表</td></tr>
    <tr>
        <th>id</th>
        <th>name</th>
        <th>sex</th>
        <th>age</th>
        <th>rank</th>
        <th>dept</th>
        <th>ops</th>
    </tr>
    <%
        ServiceUserImpl serviceUser = new ServiceUserImpl();
        List<Userinfo> userinfos = serviceUser.executeQuery("select * from userinfo");
    %>
    <%
        for(Userinfo xjj : userinfos){
    %>
    <tr>
        <td><%=xjj.getId()%></td>
        <td><%=xjj.getName()%></td>
        <td><%=xjj.getSex()==1?"男":"女"%></td>
        <td><%=xjj.getAge()%></td>
        <td><%=xjj.getRanking()%></td>
        <td><%=xjj.getDept()%></td>
        <td>
            <a href="controller.jsp?op=delete&id=<%=xjj.getId()%>"><input type="button" value="删除"></a>
            <a href="controller.jsp?op=update1&id=<%=xjj.getId()%>">修改</a>
        </td>
    </tr>
    <%}%>
    </table>
<p id="p1"> <a href="add.jsp"><input type="button" value="增加"></a></p>
<p><%=request.getParameter("feifa")==null?"":"非法入侵"%></p>
<p><%=request.getParameter("isdelete")==null?"":"删除成功"%></p>
<p><%=request.getParameter("delete")==null?"":"删除失败"%></p>
<p><%=request.getParameter("isadd")==null?"":"增加成功"%></p>
<p><%=request.getParameter("add")==null?"":"增加失败"%></p>
<p><%=request.getParameter("isupdate")==null?"":"修改成功"%></p>
<p><%=request.getParameter("update")==null?"":"修改失败"%></p>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
    $("table").css("background-color","yellow");
    $("tr:odd").css("background-color","green");
</script>
</body>
</html>
